home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / rwlocale.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  3.5 KB  |  87 lines

  1. #ifndef __STD_RWLOCALE_IMPL__
  2. #define __STD_RWLOCALE_IMPL__
  3. #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
  4.  
  5. /****************************************************************************
  6.  *
  7.  * locale.cc - Definitions of the Standard Library locale classes
  8.  *
  9.  * $Id: locale.cc,v 1.67 1996/10/22 05:11:35 delaney Exp $
  10.  *
  11.  ***************************************************************************
  12.  *
  13.  * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
  14.  * ALL RIGHTS RESERVED *
  15.  * The software and information contained herein are proprietary to, and
  16.  * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
  17.  * intends to preserve as trade secrets such software and information.
  18.  * This software is furnished pursuant to a written license agreement and
  19.  * may be used, copied, transmitted, and stored only in accordance with
  20.  * the terms of such license and with the inclusion of the above copyright
  21.  * notice.  This software and information or any other copies thereof may
  22.  * not be provided or otherwise made available to any other person.
  23.  *
  24.  * Notwithstanding any other lease or license that may pertain to, or
  25.  * accompany the delivery of, this computer software and information, the
  26.  * rights of the Government regarding its use, reproduction and disclosure
  27.  * are as set forth in Section 52.227-19 of the FARS Computer
  28.  * Software-Restricted Rights clause.
  29.  *
  30.  * Use, duplication, or disclosure by the Government is subject to
  31.  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  32.  * Technical Data and Computer Software clause at DFARS 252.227-7013.
  33.  * Contractor/Manufacturer is Rogue Wave Software, Inc.,
  34.  * P.O. Box 2328, Corvallis, Oregon 97339.
  35.  *
  36.  * This computer software and information is distributed with "restricted
  37.  * rights."  Use, duplication or disclosure is subject to restrictions as
  38.  * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
  39.  * Computer Software-Restricted Rights (April 1985)."  If the Clause at
  40.  * 18-52.227-74 "Rights in Data General" is specified in the contract,
  41.  * then the "Alternate III" clause applies.
  42.  *
  43.  ***************************************************************************/
  44.  
  45.  
  46. #ifndef __STD_RW_LOCNUMRW__
  47. #include <rw/numbrw>
  48. #endif
  49.  
  50. #ifndef _RWSTD_NO_NAMESPACE
  51. namespace std {
  52. #endif
  53.  
  54. // ------------------------------
  55. // Class locale member templates.
  56. // ------------------------------
  57.  
  58. // Operator () compares two strings according to the collate<charT> facet of
  59. // the locale.  It lets you use a locale object directly as a comparator
  60. // predicate for strings in various algorithms.  For instance, you can sort
  61. // a vector<string> according to the collating sequence of a locale with an
  62. // expression like: sort(v.begin(),v.end(),mylocale).
  63.  
  64. #ifndef _RWSTD_NO_MEMBER_TEMPLATES
  65. template <class charT, class Traits, class Allocator>
  66. bool locale::operator() (
  67.     const basic_string<charT,Traits,Allocator>& s1,
  68.     const basic_string<charT,Traits,Allocator>& s2) const
  69. {
  70. #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  71.   return use_facet<_STD::collate<charT> >(*this).compare
  72.       (s1.data(),s1.data()+s1.length(),s2.data(),s2.data()+s2.length()) < 0;
  73. #else
  74.   return use_facet(*this,(_STD::collate<charT>*)0).compare
  75.       (s1.data(),s1.data()+s1.length(),s2.data(),s2.data()+s2.length()) < 0;
  76. #endif
  77. }
  78. #endif // _RWSTD_NO_MEMBER_TEMPLATES
  79.  
  80.  
  81. #ifndef _RWSTD_NO_NAMESPACE
  82. } // namespace std
  83. #endif
  84.  
  85. #pragma option pop
  86. #endif // __STD_RWLOCALE_IMPL__
  87.